﻿namespace HRM.CORE
{
    using APP.HELPER.Data.Helper;
    using APP.HELPER.Utils.CustomizeToolbox;
    using DevExpress.XtraEditors;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Windows.Forms; using Common;

    public class HRM_WELFARE
    {
        private string m_Description;
        private string m_Form;
        private string m_Location;
        private decimal m_MoneyAllCompany;
        private decimal m_MoneyAllEmployee;
        private decimal m_MoneyAllTotal;
        private decimal m_MoneyOneCompany;
        private decimal m_MoneyOneEmployee;
        private decimal m_MoneyOneTotal;
        private decimal m_MoneyTotal;
        private string m_PartnerAddress;
        private string m_PartnerName;
        private string m_PartnerPhone;
        private DateTime m_PerformFromDate;
        private DateTime m_PerformToDate;
        private string m_PersonAddress;
        private string m_PersonEmail;
        private string m_PersonName;
        private string m_PersonPhone;
        private string m_PersonPosition;
        private DateTime m_PrepareFromDate;
        private DateTime m_PrepareToDate;
        private string m_Purpose;
        private int m_Quantity;
        private DateTime m_RegisterFromDate;
        private DateTime m_RegisterToDate;
        private int m_Status;
        private string m_WelfareCode;
        private string m_WelfareName;

        public HRM_WELFARE()
        {
            this.m_WelfareCode = "";
            this.m_WelfareName = "";
            this.m_PrepareFromDate = DateTime.Now;
            this.m_PrepareToDate = DateTime.Now;
            this.m_RegisterFromDate = DateTime.Now;
            this.m_RegisterToDate = DateTime.Now;
            this.m_PerformFromDate = DateTime.Now;
            this.m_PerformToDate = DateTime.Now;
            this.m_Purpose = "";
            this.m_Form = "";
            this.m_Location = "";
            this.m_Quantity = 0;
            this.m_Status = 0;
            this.m_MoneyOneEmployee = 0M;
            this.m_MoneyOneCompany = 0M;
            this.m_MoneyOneTotal = 0M;
            this.m_MoneyAllEmployee = 0M;
            this.m_MoneyAllCompany = 0M;
            this.m_MoneyAllTotal = 0M;
            this.m_MoneyTotal = 0M;
            this.m_PartnerName = "";
            this.m_PartnerPhone = "";
            this.m_PartnerAddress = "";
            this.m_PersonName = "";
            this.m_PersonPosition = "";
            this.m_PersonPhone = "";
            this.m_PersonEmail = "";
            this.m_PersonAddress = "";
            this.m_Description = "";
        }

        public HRM_WELFARE(string WelfareCode, string WelfareName, DateTime PrepareFromDate, DateTime PrepareToDate, DateTime RegisterFromDate, DateTime RegisterToDate, DateTime PerformFromDate, DateTime PerformToDate, string Purpose, string Form, string Location, int Quantity, int Status, decimal MoneyOneEmployee, decimal MoneyOneCompany, decimal MoneyOneTotal, decimal MoneyAllEmployee, decimal MoneyAllCompany, decimal MoneyAllTotal, decimal MoneyTotal, string PartnerName, string PartnerPhone, string PartnerAddress, string PersonName, string PersonPosition, string PersonPhone, string PersonEmail, string PersonAddress, string Description)
        {
            this.m_WelfareCode = WelfareCode;
            this.m_WelfareName = WelfareName;
            this.m_PrepareFromDate = PrepareFromDate;
            this.m_PrepareToDate = PrepareToDate;
            this.m_RegisterFromDate = RegisterFromDate;
            this.m_RegisterToDate = RegisterToDate;
            this.m_PerformFromDate = PerformFromDate;
            this.m_PerformToDate = PerformToDate;
            this.m_Purpose = Purpose;
            this.m_Form = Form;
            this.m_Location = Location;
            this.m_Quantity = Quantity;
            this.m_Status = Status;
            this.m_MoneyOneEmployee = MoneyOneEmployee;
            this.m_MoneyOneCompany = MoneyOneCompany;
            this.m_MoneyOneTotal = MoneyOneTotal;
            this.m_MoneyAllEmployee = MoneyAllEmployee;
            this.m_MoneyAllCompany = MoneyAllCompany;
            this.m_MoneyAllTotal = MoneyAllTotal;
            this.m_MoneyTotal = MoneyTotal;
            this.m_PartnerName = PartnerName;
            this.m_PartnerPhone = PartnerPhone;
            this.m_PartnerAddress = PartnerAddress;
            this.m_PersonName = PersonName;
            this.m_PersonPosition = PersonPosition;
            this.m_PersonPhone = PersonPhone;
            this.m_PersonEmail = PersonEmail;
            this.m_PersonAddress = PersonAddress;
            this.m_Description = Description;
        }

        public void AddCombo(System.Windows.Forms.ComboBox combo)
        {
            GridCalendarControlLib.TableToComboBox(combo, this.GetList(), "WelfareName", "WelfareCode");
        }

        public void AddComboAll(System.Windows.Forms.ComboBox combo)
        {
            DataTable list = new DataTable();
            list = this.GetList();
            DataRow row = list.NewRow();
            row["WelfareCode"] = "All";
            row["WelfareName"] = "Tất cả";
            list.Rows.InsertAt(row, 0);
            GridCalendarControlLib.TableToComboBox(combo, list, "WelfareName", "WelfareCode");
        }

        public void AddComboEdit(ComboBoxEdit combo)
        {
            DataTable list = new DataTable();
            list = this.GetList();
            foreach (DataRow row in list.Rows)
            {
                combo.Properties.Items.Add(row["WelfareName"]);
            }
        }

        public void AddGridLookupEdit(GridLookUpEdit gridlookup)
        {
            DataTable list = new DataTable();
            list = this.GetList();
            gridlookup.Properties.DataSource = list;
            gridlookup.Properties.DisplayMember = "WelfareName";
            gridlookup.Properties.ValueMember = "WelfareCode";
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { this.m_WelfareCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WELFARE_Delete", myParams, myValues);
        }

        public string Delete(string WelfareCode)
        {
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { WelfareCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WELFARE_Delete", myParams, myValues);
        }

        public string Delete(SqlConnection myConnection, string WelfareCode)
        {
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { WelfareCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_WELFARE_Delete", myParams, myValues);
        }

        public string Delete(SqlTransaction myTransaction, string WelfareCode)
        {
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { WelfareCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_WELFARE_Delete", myParams, myValues);
        }

        public bool Exist(string WelfareCode)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { WelfareCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_WELFARE_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public string Get(string WelfareCode)
        {
            string str = "";
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { WelfareCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_WELFARE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_WelfareCode = Convert.ToString(reader["WelfareCode"]);
                    this.m_WelfareName = Convert.ToString(reader["WelfareName"]);
                    this.m_PrepareFromDate = Convert.ToDateTime(reader["PrepareFromDate"]);
                    this.m_PrepareToDate = Convert.ToDateTime(reader["PrepareToDate"]);
                    this.m_RegisterFromDate = Convert.ToDateTime(reader["RegisterFromDate"]);
                    this.m_RegisterToDate = Convert.ToDateTime(reader["RegisterToDate"]);
                    this.m_PerformFromDate = Convert.ToDateTime(reader["PerformFromDate"]);
                    this.m_PerformToDate = Convert.ToDateTime(reader["PerformToDate"]);
                    this.m_Purpose = Convert.ToString(reader["Purpose"]);
                    this.m_Form = Convert.ToString(reader["Form"]);
                    this.m_Location = Convert.ToString(reader["Location"]);
                    this.m_Quantity = Convert.ToInt32(reader["Quantity"]);
                    this.m_Status = Convert.ToInt32(reader["Status"]);
                    this.m_MoneyOneEmployee = Convert.ToDecimal(reader["MoneyOneEmployee"]);
                    this.m_MoneyOneCompany = Convert.ToDecimal(reader["MoneyOneCompany"]);
                    this.m_MoneyOneTotal = Convert.ToDecimal(reader["MoneyOneTotal"]);
                    this.m_MoneyAllEmployee = Convert.ToDecimal(reader["MoneyAllEmployee"]);
                    this.m_MoneyAllCompany = Convert.ToDecimal(reader["MoneyAllCompany"]);
                    this.m_MoneyAllTotal = Convert.ToDecimal(reader["MoneyAllTotal"]);
                    this.m_MoneyTotal = Convert.ToDecimal(reader["MoneyTotal"]);
                    this.m_PartnerName = Convert.ToString(reader["PartnerName"]);
                    this.m_PartnerPhone = Convert.ToString(reader["PartnerPhone"]);
                    this.m_PartnerAddress = Convert.ToString(reader["PartnerAddress"]);
                    this.m_PersonName = Convert.ToString(reader["PersonName"]);
                    this.m_PersonPosition = Convert.ToString(reader["PersonPosition"]);
                    this.m_PersonPhone = Convert.ToString(reader["PersonPhone"]);
                    this.m_PersonEmail = Convert.ToString(reader["PersonEmail"]);
                    this.m_PersonAddress = Convert.ToString(reader["PersonAddress"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlConnection myConnection, string WelfareCode)
        {
            string str = "";
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { WelfareCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "HRM_WELFARE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_WelfareCode = Convert.ToString(reader["WelfareCode"]);
                    this.m_WelfareName = Convert.ToString(reader["WelfareName"]);
                    this.m_PrepareFromDate = Convert.ToDateTime(reader["PrepareFromDate"]);
                    this.m_PrepareToDate = Convert.ToDateTime(reader["PrepareToDate"]);
                    this.m_RegisterFromDate = Convert.ToDateTime(reader["RegisterFromDate"]);
                    this.m_RegisterToDate = Convert.ToDateTime(reader["RegisterToDate"]);
                    this.m_PerformFromDate = Convert.ToDateTime(reader["PerformFromDate"]);
                    this.m_PerformToDate = Convert.ToDateTime(reader["PerformToDate"]);
                    this.m_Purpose = Convert.ToString(reader["Purpose"]);
                    this.m_Form = Convert.ToString(reader["Form"]);
                    this.m_Location = Convert.ToString(reader["Location"]);
                    this.m_Quantity = Convert.ToInt32(reader["Quantity"]);
                    this.m_Status = Convert.ToInt32(reader["Status"]);
                    this.m_MoneyOneEmployee = Convert.ToDecimal(reader["MoneyOneEmployee"]);
                    this.m_MoneyOneCompany = Convert.ToDecimal(reader["MoneyOneCompany"]);
                    this.m_MoneyOneTotal = Convert.ToDecimal(reader["MoneyOneTotal"]);
                    this.m_MoneyAllEmployee = Convert.ToDecimal(reader["MoneyAllEmployee"]);
                    this.m_MoneyAllCompany = Convert.ToDecimal(reader["MoneyAllCompany"]);
                    this.m_MoneyAllTotal = Convert.ToDecimal(reader["MoneyAllTotal"]);
                    this.m_MoneyTotal = Convert.ToDecimal(reader["MoneyTotal"]);
                    this.m_PartnerName = Convert.ToString(reader["PartnerName"]);
                    this.m_PartnerPhone = Convert.ToString(reader["PartnerPhone"]);
                    this.m_PartnerAddress = Convert.ToString(reader["PartnerAddress"]);
                    this.m_PersonName = Convert.ToString(reader["PersonName"]);
                    this.m_PersonPosition = Convert.ToString(reader["PersonPosition"]);
                    this.m_PersonPhone = Convert.ToString(reader["PersonPhone"]);
                    this.m_PersonEmail = Convert.ToString(reader["PersonEmail"]);
                    this.m_PersonAddress = Convert.ToString(reader["PersonAddress"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlTransaction myTransaction, string WelfareCode)
        {
            string str = "";
            string[] myParams = new string[] { "@WelfareCode" };
            object[] myValues = new object[] { WelfareCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "HRM_WELFARE_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_WelfareCode = Convert.ToString(reader["WelfareCode"]);
                    this.m_WelfareName = Convert.ToString(reader["WelfareName"]);
                    this.m_PrepareFromDate = Convert.ToDateTime(reader["PrepareFromDate"]);
                    this.m_PrepareToDate = Convert.ToDateTime(reader["PrepareToDate"]);
                    this.m_RegisterFromDate = Convert.ToDateTime(reader["RegisterFromDate"]);
                    this.m_RegisterToDate = Convert.ToDateTime(reader["RegisterToDate"]);
                    this.m_PerformFromDate = Convert.ToDateTime(reader["PerformFromDate"]);
                    this.m_PerformToDate = Convert.ToDateTime(reader["PerformToDate"]);
                    this.m_Purpose = Convert.ToString(reader["Purpose"]);
                    this.m_Form = Convert.ToString(reader["Form"]);
                    this.m_Location = Convert.ToString(reader["Location"]);
                    this.m_Quantity = Convert.ToInt32(reader["Quantity"]);
                    this.m_Status = Convert.ToInt32(reader["Status"]);
                    this.m_MoneyOneEmployee = Convert.ToDecimal(reader["MoneyOneEmployee"]);
                    this.m_MoneyOneCompany = Convert.ToDecimal(reader["MoneyOneCompany"]);
                    this.m_MoneyOneTotal = Convert.ToDecimal(reader["MoneyOneTotal"]);
                    this.m_MoneyAllEmployee = Convert.ToDecimal(reader["MoneyAllEmployee"]);
                    this.m_MoneyAllCompany = Convert.ToDecimal(reader["MoneyAllCompany"]);
                    this.m_MoneyAllTotal = Convert.ToDecimal(reader["MoneyAllTotal"]);
                    this.m_MoneyTotal = Convert.ToDecimal(reader["MoneyTotal"]);
                    this.m_PartnerName = Convert.ToString(reader["PartnerName"]);
                    this.m_PartnerPhone = Convert.ToString(reader["PartnerPhone"]);
                    this.m_PartnerAddress = Convert.ToString(reader["PartnerAddress"]);
                    this.m_PersonName = Convert.ToString(reader["PersonName"]);
                    this.m_PersonPosition = Convert.ToString(reader["PersonPosition"]);
                    this.m_PersonPhone = Convert.ToString(reader["PersonPhone"]);
                    this.m_PersonEmail = Convert.ToString(reader["PersonEmail"]);
                    this.m_PersonAddress = Convert.ToString(reader["PersonAddress"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public DataTable GetList()
        {
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_WELFARE_GetList");
        }

        public string Insert()
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                this.m_WelfareCode, this.m_WelfareName, this.m_PrepareFromDate, this.m_PrepareToDate, this.m_RegisterFromDate, this.m_RegisterToDate, this.m_PerformFromDate, this.m_PerformToDate, this.m_Purpose, this.m_Form, this.m_Location, this.m_Quantity, this.m_Status, this.m_MoneyOneEmployee, this.m_MoneyOneCompany, this.m_MoneyOneTotal, 
                this.m_MoneyAllEmployee, this.m_MoneyAllCompany, this.m_MoneyAllTotal, this.m_MoneyTotal, this.m_PartnerName, this.m_PartnerPhone, this.m_PartnerAddress, this.m_PersonName, this.m_PersonPosition, this.m_PersonPhone, this.m_PersonEmail, this.m_PersonAddress, this.m_Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WELFARE_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                this.m_WelfareCode, this.m_WelfareName, this.m_PrepareFromDate, this.m_PrepareToDate, this.m_RegisterFromDate, this.m_RegisterToDate, this.m_PerformFromDate, this.m_PerformToDate, this.m_Purpose, this.m_Form, this.m_Location, this.m_Quantity, this.m_Status, this.m_MoneyOneEmployee, this.m_MoneyOneCompany, this.m_MoneyOneTotal, 
                this.m_MoneyAllEmployee, this.m_MoneyAllCompany, this.m_MoneyAllTotal, this.m_MoneyTotal, this.m_PartnerName, this.m_PartnerPhone, this.m_PartnerAddress, this.m_PersonName, this.m_PersonPosition, this.m_PersonPhone, this.m_PersonEmail, this.m_PersonAddress, this.m_Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_WELFARE_Insert", myParams, myValues);
        }

        public string Insert(string WelfareCode, string WelfareName, DateTime PrepareFromDate, DateTime PrepareToDate, DateTime RegisterFromDate, DateTime RegisterToDate, DateTime PerformFromDate, DateTime PerformToDate, string Purpose, string Form, string Location, int Quantity, int Status, decimal MoneyOneEmployee, decimal MoneyOneCompany, decimal MoneyOneTotal, decimal MoneyAllEmployee, decimal MoneyAllCompany, decimal MoneyAllTotal, decimal MoneyTotal, string PartnerName, string PartnerPhone, string PartnerAddress, string PersonName, string PersonPosition, string PersonPhone, string PersonEmail, string PersonAddress, string Description)
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                WelfareCode, WelfareName, PrepareFromDate, PrepareToDate, RegisterFromDate, RegisterToDate, PerformFromDate, PerformToDate, Purpose, Form, Location, Quantity, Status, MoneyOneEmployee, MoneyOneCompany, MoneyOneTotal, 
                MoneyAllEmployee, MoneyAllCompany, MoneyAllTotal, MoneyTotal, PartnerName, PartnerPhone, PartnerAddress, PersonName, PersonPosition, PersonPhone, PersonEmail, PersonAddress, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WELFARE_Insert", myParams, myValues);
        }

        public string Insert(SqlConnection myConnection, string WelfareCode, string WelfareName, DateTime PrepareFromDate, DateTime PrepareToDate, DateTime RegisterFromDate, DateTime RegisterToDate, DateTime PerformFromDate, DateTime PerformToDate, string Purpose, string Form, string Location, int Quantity, int Status, decimal MoneyOneEmployee, decimal MoneyOneCompany, decimal MoneyOneTotal, decimal MoneyAllEmployee, decimal MoneyAllCompany, decimal MoneyAllTotal, decimal MoneyTotal, string PartnerName, string PartnerPhone, string PartnerAddress, string PersonName, string PersonPosition, string PersonPhone, string PersonEmail, string PersonAddress, string Description)
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                WelfareCode, WelfareName, PrepareFromDate, PrepareToDate, RegisterFromDate, RegisterToDate, PerformFromDate, PerformToDate, Purpose, Form, Location, Quantity, Status, MoneyOneEmployee, MoneyOneCompany, MoneyOneTotal, 
                MoneyAllEmployee, MoneyAllCompany, MoneyAllTotal, MoneyTotal, PartnerName, PartnerPhone, PartnerAddress, PersonName, PersonPosition, PersonPhone, PersonEmail, PersonAddress, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_WELFARE_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction, string WelfareCode, string WelfareName, DateTime PrepareFromDate, DateTime PrepareToDate, DateTime RegisterFromDate, DateTime RegisterToDate, DateTime PerformFromDate, DateTime PerformToDate, string Purpose, string Form, string Location, int Quantity, int Status, decimal MoneyOneEmployee, decimal MoneyOneCompany, decimal MoneyOneTotal, decimal MoneyAllEmployee, decimal MoneyAllCompany, decimal MoneyAllTotal, decimal MoneyTotal, string PartnerName, string PartnerPhone, string PartnerAddress, string PersonName, string PersonPosition, string PersonPhone, string PersonEmail, string PersonAddress, string Description)
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                WelfareCode, WelfareName, PrepareFromDate, PrepareToDate, RegisterFromDate, RegisterToDate, PerformFromDate, PerformToDate, Purpose, Form, Location, Quantity, Status, MoneyOneEmployee, MoneyOneCompany, MoneyOneTotal, 
                MoneyAllEmployee, MoneyAllCompany, MoneyAllTotal, MoneyTotal, PartnerName, PartnerPhone, PartnerAddress, PersonName, PersonPosition, PersonPhone, PersonEmail, PersonAddress, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_WELFARE_Insert", myParams, myValues);
        }

        public string NewID()
        {
            return SqlHelper.GenCode("HRM_WELFARE", "WelfareCode", "CV");
        }

        public string Update()
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                this.m_WelfareCode, this.m_WelfareName, this.m_PrepareFromDate, this.m_PrepareToDate, this.m_RegisterFromDate, this.m_RegisterToDate, this.m_PerformFromDate, this.m_PerformToDate, this.m_Purpose, this.m_Form, this.m_Location, this.m_Quantity, this.m_Status, this.m_MoneyOneEmployee, this.m_MoneyOneCompany, this.m_MoneyOneTotal, 
                this.m_MoneyAllEmployee, this.m_MoneyAllCompany, this.m_MoneyAllTotal, this.m_MoneyTotal, this.m_PartnerName, this.m_PartnerPhone, this.m_PartnerAddress, this.m_PersonName, this.m_PersonPosition, this.m_PersonPhone, this.m_PersonEmail, this.m_PersonAddress, this.m_Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WELFARE_Update", myParams, myValues);
        }

        public string Update(string WelfareCode, string WelfareName, DateTime PrepareFromDate, DateTime PrepareToDate, DateTime RegisterFromDate, DateTime RegisterToDate, DateTime PerformFromDate, DateTime PerformToDate, string Purpose, string Form, string Location, int Quantity, int Status, decimal MoneyOneEmployee, decimal MoneyOneCompany, decimal MoneyOneTotal, decimal MoneyAllEmployee, decimal MoneyAllCompany, decimal MoneyAllTotal, decimal MoneyTotal, string PartnerName, string PartnerPhone, string PartnerAddress, string PersonName, string PersonPosition, string PersonPhone, string PersonEmail, string PersonAddress, string Description)
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                WelfareCode, WelfareName, PrepareFromDate, PrepareToDate, RegisterFromDate, RegisterToDate, PerformFromDate, PerformToDate, Purpose, Form, Location, Quantity, Status, MoneyOneEmployee, MoneyOneCompany, MoneyOneTotal, 
                MoneyAllEmployee, MoneyAllCompany, MoneyAllTotal, MoneyTotal, PartnerName, PartnerPhone, PartnerAddress, PersonName, PersonPosition, PersonPhone, PersonEmail, PersonAddress, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WELFARE_Update", myParams, myValues);
        }

        public string Update(SqlConnection myConnection, string WelfareCode, string WelfareName, DateTime PrepareFromDate, DateTime PrepareToDate, DateTime RegisterFromDate, DateTime RegisterToDate, DateTime PerformFromDate, DateTime PerformToDate, string Purpose, string Form, string Location, int Quantity, int Status, decimal MoneyOneEmployee, decimal MoneyOneCompany, decimal MoneyOneTotal, decimal MoneyAllEmployee, decimal MoneyAllCompany, decimal MoneyAllTotal, decimal MoneyTotal, string PartnerName, string PartnerPhone, string PartnerAddress, string PersonName, string PersonPosition, string PersonPhone, string PersonEmail, string PersonAddress, string Description)
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                WelfareCode, WelfareName, PrepareFromDate, PrepareToDate, RegisterFromDate, RegisterToDate, PerformFromDate, PerformToDate, Purpose, Form, Location, Quantity, Status, MoneyOneEmployee, MoneyOneCompany, MoneyOneTotal, 
                MoneyAllEmployee, MoneyAllCompany, MoneyAllTotal, MoneyTotal, PartnerName, PartnerPhone, PartnerAddress, PersonName, PersonPosition, PersonPhone, PersonEmail, PersonAddress, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_WELFARE_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction, string WelfareCode, string WelfareName, DateTime PrepareFromDate, DateTime PrepareToDate, DateTime RegisterFromDate, DateTime RegisterToDate, DateTime PerformFromDate, DateTime PerformToDate, string Purpose, string Form, string Location, int Quantity, int Status, decimal MoneyOneEmployee, decimal MoneyOneCompany, decimal MoneyOneTotal, decimal MoneyAllEmployee, decimal MoneyAllCompany, decimal MoneyAllTotal, decimal MoneyTotal, string PartnerName, string PartnerPhone, string PartnerAddress, string PersonName, string PersonPosition, string PersonPhone, string PersonEmail, string PersonAddress, string Description)
        {
            string[] myParams = new string[] { 
                "@WelfareCode", "@WelfareName", "@PrepareFromDate", "@PrepareToDate", "@RegisterFromDate", "@RegisterToDate", "@PerformFromDate", "@PerformToDate", "@Purpose", "@Form", "@Location", "@Quantity", "@Status", "@MoneyOneEmployee", "@MoneyOneCompany", "@MoneyOneTotal", 
                "@MoneyAllEmployee", "@MoneyAllCompany", "@MoneyAllTotal", "@MoneyTotal", "@PartnerName", "@PartnerPhone", "@PartnerAddress", "@PersonName", "@PersonPosition", "@PersonPhone", "@PersonEmail", "@PersonAddress", "@Description"
             };
            object[] myValues = new object[] { 
                WelfareCode, WelfareName, PrepareFromDate, PrepareToDate, RegisterFromDate, RegisterToDate, PerformFromDate, PerformToDate, Purpose, Form, Location, Quantity, Status, MoneyOneEmployee, MoneyOneCompany, MoneyOneTotal, 
                MoneyAllEmployee, MoneyAllCompany, MoneyAllTotal, MoneyTotal, PartnerName, PartnerPhone, PartnerAddress, PersonName, PersonPosition, PersonPhone, PersonEmail, PersonAddress, Description
             };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_WELFARE_Update", myParams, myValues);
        }

        [DisplayName("Description"), Category("Column")]
        public string Description
        {
            get
            {
                return this.m_Description;
            }
            set
            {
                this.m_Description = value;
            }
        }

        [Category("Column"), DisplayName("Form")]
        public string Form
        {
            get
            {
                return this.m_Form;
            }
            set
            {
                this.m_Form = value;
            }
        }

        [DisplayName("Location"), Category("Column")]
        public string Location
        {
            get
            {
                return this.m_Location;
            }
            set
            {
                this.m_Location = value;
            }
        }

        [DisplayName("MoneyAllCompany"), Category("Column")]
        public decimal MoneyAllCompany
        {
            get
            {
                return this.m_MoneyAllCompany;
            }
            set
            {
                this.m_MoneyAllCompany = value;
            }
        }

        [DisplayName("MoneyAllEmployee"), Category("Column")]
        public decimal MoneyAllEmployee
        {
            get
            {
                return this.m_MoneyAllEmployee;
            }
            set
            {
                this.m_MoneyAllEmployee = value;
            }
        }

        [Category("Column"), DisplayName("MoneyAllTotal")]
        public decimal MoneyAllTotal
        {
            get
            {
                return this.m_MoneyAllTotal;
            }
            set
            {
                this.m_MoneyAllTotal = value;
            }
        }

        [DisplayName("MoneyOneCompany"), Category("Column")]
        public decimal MoneyOneCompany
        {
            get
            {
                return this.m_MoneyOneCompany;
            }
            set
            {
                this.m_MoneyOneCompany = value;
            }
        }

        [Category("Column"), DisplayName("MoneyOneEmployee")]
        public decimal MoneyOneEmployee
        {
            get
            {
                return this.m_MoneyOneEmployee;
            }
            set
            {
                this.m_MoneyOneEmployee = value;
            }
        }

        [Category("Column"), DisplayName("MoneyOneTotal")]
        public decimal MoneyOneTotal
        {
            get
            {
                return this.m_MoneyOneTotal;
            }
            set
            {
                this.m_MoneyOneTotal = value;
            }
        }

        [Category("Column"), DisplayName("MoneyTotal")]
        public decimal MoneyTotal
        {
            get
            {
                return this.m_MoneyTotal;
            }
            set
            {
                this.m_MoneyTotal = value;
            }
        }

        [DisplayName("PartnerAddress"), Category("Column")]
        public string PartnerAddress
        {
            get
            {
                return this.m_PartnerAddress;
            }
            set
            {
                this.m_PartnerAddress = value;
            }
        }

        [Category("Column"), DisplayName("PartnerName")]
        public string PartnerName
        {
            get
            {
                return this.m_PartnerName;
            }
            set
            {
                this.m_PartnerName = value;
            }
        }

        [DisplayName("PartnerPhone"), Category("Column")]
        public string PartnerPhone
        {
            get
            {
                return this.m_PartnerPhone;
            }
            set
            {
                this.m_PartnerPhone = value;
            }
        }

        [Category("Column"), DisplayName("PerformFromDate")]
        public DateTime PerformFromDate
        {
            get
            {
                return this.m_PerformFromDate;
            }
            set
            {
                this.m_PerformFromDate = value;
            }
        }

        [DisplayName("PerformToDate"), Category("Column")]
        public DateTime PerformToDate
        {
            get
            {
                return this.m_PerformToDate;
            }
            set
            {
                this.m_PerformToDate = value;
            }
        }

        [DisplayName("PersonAddress"), Category("Column")]
        public string PersonAddress
        {
            get
            {
                return this.m_PersonAddress;
            }
            set
            {
                this.m_PersonAddress = value;
            }
        }

        [Category("Column"), DisplayName("PersonEmail")]
        public string PersonEmail
        {
            get
            {
                return this.m_PersonEmail;
            }
            set
            {
                this.m_PersonEmail = value;
            }
        }

        [DisplayName("PersonName"), Category("Column")]
        public string PersonName
        {
            get
            {
                return this.m_PersonName;
            }
            set
            {
                this.m_PersonName = value;
            }
        }

        [DisplayName("PersonPhone"), Category("Column")]
        public string PersonPhone
        {
            get
            {
                return this.m_PersonPhone;
            }
            set
            {
                this.m_PersonPhone = value;
            }
        }

        [DisplayName("PersonPosition"), Category("Column")]
        public string PersonPosition
        {
            get
            {
                return this.m_PersonPosition;
            }
            set
            {
                this.m_PersonPosition = value;
            }
        }

        [DisplayName("PrepareFromDate"), Category("Column")]
        public DateTime PrepareFromDate
        {
            get
            {
                return this.m_PrepareFromDate;
            }
            set
            {
                this.m_PrepareFromDate = value;
            }
        }

        [DisplayName("PrepareToDate"), Category("Column")]
        public DateTime PrepareToDate
        {
            get
            {
                return this.m_PrepareToDate;
            }
            set
            {
                this.m_PrepareToDate = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class HRM_WELFARE";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }

        [DisplayName("Purpose"), Category("Column")]
        public string Purpose
        {
            get
            {
                return this.m_Purpose;
            }
            set
            {
                this.m_Purpose = value;
            }
        }

        [Category("Column"), DisplayName("Quantity")]
        public int Quantity
        {
            get
            {
                return this.m_Quantity;
            }
            set
            {
                this.m_Quantity = value;
            }
        }

        [DisplayName("RegisterFromDate"), Category("Column")]
        public DateTime RegisterFromDate
        {
            get
            {
                return this.m_RegisterFromDate;
            }
            set
            {
                this.m_RegisterFromDate = value;
            }
        }

        [DisplayName("RegisterToDate"), Category("Column")]
        public DateTime RegisterToDate
        {
            get
            {
                return this.m_RegisterToDate;
            }
            set
            {
                this.m_RegisterToDate = value;
            }
        }

        [DisplayName("Status"), Category("Column")]
        public int Status
        {
            get
            {
                return this.m_Status;
            }
            set
            {
                this.m_Status = value;
            }
        }

        [DisplayName("WelfareCode"), Category("Primary Key")]
        public string WelfareCode
        {
            get
            {
                return this.m_WelfareCode;
            }
            set
            {
                this.m_WelfareCode = value;
            }
        }

        [Category("Column"), DisplayName("WelfareName")]
        public string WelfareName
        {
            get
            {
                return this.m_WelfareName;
            }
            set
            {
                this.m_WelfareName = value;
            }
        }
    }
}

